$login={
	get svcLogin(){
		var CCFX2 = Components.classes["@mozilla.org/passwordmanager;1"];
		var CCFX3 = Components.classes["@mozilla.org/login-manager;1"];
		if (CCFX2 != null) {
			return Components.classes["@mozilla.org/passwordmanager;1"].getService(Components.interfaces.nsIPasswordManager);
		}else if (CCFX3!= null) {
			return Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
		}
	},
	get version(){
		if(Components.classes["@mozilla.org/login-manager;1"]){return "1.9";}
		if(Components.classes["@mozilla.org/passwordmanager;1"]){return "1.8";}
		return false;
	},
	
	getAll:function(){
		
		var obj=[]
		if(this.version==false){return}
		if(this.version=="1.9"){
			return this.svcLogin.getAllLogins({});
	/*		for (var i=0;i<=arr.length;i++){
				obj.push({"hostname":arr[i].hostname, "formSubmitURL":"httpRealm":"username":"usernameField": "password":"passwordField":});
				this.log(arr[i].hostname)
			}*/
		}
		if(this.version=="1.8"){
			var enumerator = this.svcLogin.enumerator;
			while (enumerator.hasMoreElements()) {
				var nextPassword;
				try {
					nextPassword = enumerator.getNext();
				} catch(e) {
					return false;
				}
				nextPassword = nextPassword.QueryInterface(Components.interfaces.nsIPassword);
				var host = nextPassword.host;
				try {
					user = nextPassword.user;
					password = nextPassword.password;
				} catch (e) {
					continue;
				}
				obj.push({"hostname":host, "username":user, "password":password});
			}
			return obj;
		}
	},
	log: function (str){
		Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService).logStringMessage(str);
	},
}